{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-08-18T09:58:15.817113Z",
     "start_time": "2025-08-18T09:58:05.214040Z"
    }
   },
   "source": [
    "import os\n",
    "from openai import OpenAI\n",
    "client = OpenAI(\n",
    "    # 若没有配置环境变量，请用百炼API Key将下行替换为：api_key=\"sk-xxx\",\n",
    "    api_key=os.getenv(\"DASH_SCOPE_API_KEY\"), # 如何获取API Key：https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key\n",
    "    base_url=\"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n",
    ")\n",
    "\n",
    "\n",
    "completion = client.chat.completions.create(\n",
    "    # 模型列表：https://help.aliyun.com/zh/model-studio/getting-started/models\n",
    "    model=\"qwen-plus\",  # qwen-plus 属于 qwen3 模型，如需开启思考模式，请参见：https://help.aliyun.com/zh/model-studio/deep-thinking\n",
    "    messages=[\n",
    "        {'role': 'system', 'content': 'You are a helpful assistant.'},\n",
    "        {'role': 'user', 'content': '请给我的花店起个名'}\n",
    "    ]\n",
    ")\n",
    "print(completion.choices[0].message.content)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当然可以！为了帮你起一个贴合你花店风格的名字，我需要了解一些基本信息：\n",
      "\n",
      "1. **花店的风格或主题**：是浪漫温馨、简约清新，还是高端大气？\n",
      "2. **主要售卖的花种**：比如玫瑰、永生花、多肉植物，或者综合类鲜花？\n",
      "3. **目标客户群**：年轻人、情侣、商务人士，还是大众群体？\n",
      "4. **你希望传达的感觉**：幸福、治愈、优雅、自然，还是个性独特？\n",
      "\n",
      "如果你愿意提供这些信息，我可以为你量身定制几个名字。  \n",
      "如果暂时不确定，我也可以先提供一些通用但好听的花店名字供你参考：\n",
      "\n",
      "### 好听的花店名字推荐：\n",
      "\n",
      "1. **花间一壶酒**（文艺又浪漫）\n",
      "2. **花点时间遇见你**（温馨、有故事感）\n",
      "3. **花语时光**（表达花的语言与时间的美好）\n",
      "4. **初见花坊**（寓意第一次见到花的惊艳）\n",
      "5. **拾光花艺**（“拾”光寓意捡拾美好时光）\n",
      "6. **花漾年华**（青春、美好、有画面感）\n",
      "7. **一朵小红花**（可爱、温暖又有记忆点）\n",
      "8. **云养花舍**（适合主打线上配送或清新风格）\n",
      "9. **花未眠**（诗意，适合夜景或文艺路线）\n",
      "10. **花开四季**（寓意生意长长久久）\n",
      "\n",
      "如果你告诉我更多关于你的花店特色，我可以再优化出更贴切的名字哦！  \n",
      "你也可以从中挑选一个喜欢的方向，我可以帮你延伸设计LOGO或宣传语。😊\n"
     ]
    }
   ],
   "execution_count": 11
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "de0081150db97bff"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
